package com.sesame.controller;

import kim.sesame.framework.web.annotation.IgnoreLoginCheck;
import kim.sesame.framework.web.annotation.IgnoreReqLogPrint;
import kim.sesame.framework.web.config.WebProperties;
import kim.sesame.framework.web.controller.AbstractWebController;
import lombok.extern.apachecommons.CommonsLog;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;


@CommonsLog
@Controller
@RequestMapping("/p")
public class PController extends AbstractWebController {

    @Resource
    private WebProperties webProperties;

    /**
     * 加载界面
     */
    @IgnoreReqLogPrint
    @IgnoreLoginCheck
    @RequestMapping("/{uriPath}")
    public String index(@PathVariable("uriPath") String uriPath, HttpServletRequest request, ModelMap modelMap) {
        uriPath = uriPath.replaceAll(webProperties.getPageReplace(), "/");
        return uriPath;
    }

}